<script>

//1、promise.then()返回的是新的promise
//新promise的状态和值由then指定的回调函数的执行结果决定
//1)若不做任何处理，则默认返回fulfilled，值为undefined。因为函数内部最后默认return undefined
//2)若return非promise对象，则返回fulfilled，值为return的值
//3)若return是promise对象，则返回此promise
//4)若throw则返回rejected，值为throw的值
new Promise((resolve, reject) => {
    resolve(1)
}).then(
    value => {
        console.log('success1',value)
        // return undefined //默认为undefined
        // return 1
        // return Promise.resolve(2)
        // return Promise.reject(3)
        throw 4
    },
    reason => {
        console.log('failure1',reason)
    }
).then(
    value => {
        console.log('success2',value)
    },
    reason => {
        console.log('failure2',reason)
    }
)

console.log(new Promise((resolve,reject) => {
    resolve(1)
}));
</script>